package com.study.d019fxml.userstructargs.map;

import java.util.HashMap;

import com.study.d019fxml.userstructargs.Person;

import javafx.util.Builder;

/**
*@description
*@author xtayhame
*date 2020年3月17日
*version
*since v1.0
*/
public class PersonBuilderMap extends HashMap<String, Object> implements Builder<Person>{
	private String name;
	private int age;


	@Override
	public Object put(String key, Object value) {
		System.out.println("PersonBuilderMap.put()");
		if("name".equals(key)){
			this.name = value.toString();
		}else if("age".equals(key)){
			this.age = Integer.valueOf(value.toString());
		}

		return null;
	}

	@Override
	public Person build() {
		System.out.println("PersonBuilderMap.build()");
		return new Person(name,age);
	}

}
